<?php

namespace app\company\validate;


class CompanyUserValidate extends BaseValidate
{
    public function __construct()
    {
        $rule = [
            'user_name'             => 'require|length:6,15|unique:company_user',
            'password'              => 'require|length:6,15',
            'password_confirmation' => 'require|confirm:password',
            'role_id'               => 'require',
        ];

        $message = [
            'user_name.require'             => '用户名必须',
            'user_name.length'              => '用户名长度6-15位',
            'user_name.unique'              => '用户名已存在',
            'password.require'              => '密码必须',
            'password.length'               => '密码长度6-15位',
            'password_confirmation.require' => '确认密码必须',
            'password_confirmation.confirm' => '两次密码不一致',
            'role_id.require'               => '角色必须',
        ];

        $scene = [
//            'add'  => ['user_name', 'password', 'role_id'],
            'add'  => ['user_name', 'password'],
        ];
        parent::__construct($rule, $message, $scene);
    }
}